package com.admin.controller.v1;

import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.PageResponseResult;
import com.usian.model.common.dtos.ResponseResult;
import com.admin.service.AdsensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author szx
 * @date 2022/10/10
 * @description
 */
@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController {

    @Autowired
    private AdsensitiveService as;

    @PostMapping("findAll")
    public PageResponseResult findAll(@RequestBody SensitiveDto sensitiveDto){
        return as.findAll(sensitiveDto);
    }

    @GetMapping("findById/{id}")
    public ResponseResult findByIds(@PathVariable("id") Integer id){
        return as.findByIds(id);
    }

    @PostMapping("add")
    public ResponseResult add(@RequestBody AdSensitive sensitive){
        return as.add(sensitive);
    }

    @PutMapping("edit")
    public ResponseResult edit(@RequestBody AdSensitive sensitive){
        return as.edit(sensitive);
    }

    @DeleteMapping("del/{id}")
    public ResponseResult del(@PathVariable("id")Integer id){
        return as.del(id);
    }

    @PostMapping("delAll")
    public ResponseResult delAll(Integer[] ids){
        return as.delAll(ids);
    }


    /*@PostMapping
    public ResponseResult saveSensitive(@RequestBody AdSensitive adSensitive) {
        return as.saveSensitive(adSensitive);
    }

    @GetMapping("/{id}")
    public ResponseResult findById(@PathVariable("id") Integer id) {
        return as.findById(id);
    }*/
}
